package com.changzhi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changzhi.ldyl.model.GiftConfig;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huangrc
 * @since 2020-12-15
 */
public interface GiftConfigMapper extends BaseMapper<GiftConfig> {

	@Select("SELECT yl_gift_config.*,ROUND(p.property1*1000) AS probability FROM yl_gift_config INNER JOIN (SELECT NAME AS id,property1 FROM yl_sys_dict WHERE CODE=#{code} AND `status`='VALID' ORDER BY property1+0 DESC) p ON yl_gift_config.id=p.id ORDER BY probability desc")
	List<GiftConfig> selectActivityPrize(String code);
}
